﻿/************************************************************************
 * SMLib - State Model Library
 * Copyright (C) 2012-2013 Ali Khalili (khalili_DOT_ir_@SIGN_gmail_DOT_com)
 * **********************************************************************
 * This program is free software; you can redistribute it and/or modify it
 * under the terms of the GNU Lesser General Public License (LGPL) published 
 * by the Free Software Foundation; either version 2.1 of the License, or (at your
 * option) any later version. This program is distributed without any
 * warranty. See the GNU Lesser General Public License for more details. 
 * ***********************************************************************
 * File         :     SMLib\Automata\Utils\AutomataUtils.cs
 * Description  :     Some Utility Functions shared for all automata
 * Change log   :     -17 May 2013:  Initial development
 * To Do        :
 ************************************************************************/
//#define USE_VISUALISATION

using System;
using System.Collections.Generic;
using SMLib.Base;

namespace SMLib.Utils
{
    /// <summary>
    /// Some Utility Functions shared for all automata
    /// </summary>
    public class AutomataUtils<STATETYPE, TRANSITIONTYPE>
    {
        /// <summary>
        /// Count number of edges in a -directed- graph
        /// </summary>
        /// <param name="st">the state space</param>
        /// <returns>Number of edges/transitions in all states</returns>
        public static int CountEdges(IDiGraph<STATETYPE, TRANSITIONTYPE> st)
        {
            int n = 0;
            foreach (STATETYPE s in st.GetStates())
            {
                n += st.TransitionsOf(s).Count;
            }
            return n;
        }
		
		
		/// <summary>
        /// Find non-reachable states (from state 0-i.e. initial state) and remove them
        /// </summary>
        /// <param name="st"></param>
        public static void RemoveNonreachable(IDiGraph<STATETYPE, TRANSITIONTYPE> st)
        {
			throw new NotImplementedException();
        }
    }
	
}
